package com.ogawa.project6602.wdiget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.SeekBar;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatSeekBar;

import com.blankj.utilcode.util.LogUtils;
import com.ogawa.project6602.R;

public class JustVolumeWidget extends FrameLayout {
    View view;
    TextView mainMusicTv;
    TextView volumeValueTv;
    AppCompatSeekBar mainMusicSeekBar;

    public JustVolumeWidget(@NonNull Context context) {
        super(context);
        initView();
    }

    public JustVolumeWidget(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initView();
    }

    public JustVolumeWidget(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView();
    }

    void initView(){
        view  = LayoutInflater.from(getContext()).inflate(R.layout.widget_adjust_music,null);
        mainMusicTv = view.findViewById(R.id.mainMusicTv);
        volumeValueTv = view.findViewById(R.id.volumeValueTv);
        mainMusicSeekBar = view.findViewById(R.id.mainMusicSeekBar);
        addView(view);
    }
    public void setTitle(String title){
        mainMusicTv.setText(title);
    }
    public void setProgress(int progress){
        volumeValueTv.setText("" + progress);
        mainMusicSeekBar.setProgress(progress);
        mainMusicSeekBar.setSecondaryProgress(progress+3);
    }
    public void setProgressListener(SeekBar.OnSeekBarChangeListener listener){
        mainMusicSeekBar.setOnSeekBarChangeListener(listener);
    }


}
